package com.yaoxuguang.concurrence.simpleDataFormate_thread_question;

import java.text.SimpleDateFormat;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.simpleDataFormate_thread_question
 * @Description: TODO
 * @date 2018年12月26日14:33
 */
public class DateTools {
    private static ThreadLocal<SimpleDateFormat> t1 = new ThreadLocal<>();
    public static SimpleDateFormat getSimpleDateFormat(String datePattern){
        SimpleDateFormat simpleDateFormat = null;
        simpleDateFormat = t1.get();
        if(simpleDateFormat == null){
            simpleDateFormat = new SimpleDateFormat(datePattern);
            t1.set(simpleDateFormat);
        }
        return simpleDateFormat;
    }
}
